package design_pattern.momento.test1;

/**
 * Created by WeiDingKuo on 2017/10/27 14:21
 * <p>
 * 需要备忘的原始类，可以创建备忘录和通过备忘录还原状态
 */
public class Orignator {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Momento createMomento() {
        return new Momento(this.name);
    }

    public void restoreMoment(Momento momento) {
        this.name = momento.getName();
    }
}
